{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/addons/builder/css/base.css" media="all">
<style>
	#table th,#table td{
		text-align: center;
	}

	.layui-table thead{
		background: rgb(231, 238, 253,0.4);
		color: #515a6e;
	}
	.layui-table thead th{
		height: 28px;
		line-height: 28px;
	}

	.layui-table tbody td{
		height: 30px;
		line-height: 30px;
	}
	.layui-table .layui-form-switch{
		margin-top: initial;
	}
	.layui-btn+.layui-btn{
		margin-left: 0;
	}
</style>
<body>
<div class="layui-fluid layui-anim layui-leftbit">
	<div class="layui-card" style="padding-top: 5px">
		<div class="layui-card-body">
			<div>
				<div class="layui-btn-container">
					<a class="layui-btn layui-btn-normal layui-btn-sm" onclick="openDrawer('新增菜单','{:url(\'edit\',[\'id\'=>0])}','50%','l')">
						<i class="layui-icon layui-icon-add-circle-fine"></i>新增
					</a>
					<a class="layui-btn layui-btn-danger layui-btn-sm" data-url="{:url('delete')}" onclick="removeAll($(this));">
						<i class="layui-icon layui-icon-delete"></i>批量删除
					</a>
					<a class="layui-btn layui-btn-sm" style="background: #17a2b8" onclick="openAllCate($(this));">
						<i class="layui-icon layui-icon-util"></i><span class="show_text">展开</span>
					</a>
				</div>
			</div>
			<table class="layui-table layui-form" id="table" lay-size="sm">
				<thead>
					<tr>
						<th style="width: 20px"><input type="checkbox" lay-filter="list_all" lay-skin="primary"/></th>
						<th>菜单名称</th>
						<th>菜单简称</th>
						<th>菜单图标</th>
						<th>菜单节点</th>
						<th width="120px;">状态</th>
						<th width="120px;">排序</th>
						<th>创建时间</th>
						<th>更新时间</th>
						<th width="{:getBtnWidth('190')}px;">操作</th>
					</tr>
				</thead>
				<tbody>
					{foreach name="menus" id="v"}
					<tr cate-id='{$v.id}' fid='{$v.pid}' level="{if $v.pid <= 0}0{else}{$v.lvl}{/if}" class="{if $v.lvl>1}layui-anim layui-anim-up layui-anim-downbit showAll{/if}" {if $v.lvl>1}style="display: none" {/if}>
						<td><input type="checkbox" lay-filter="list_checkbox" lay-skin="primary" value="{$v.id}"/></td>
						<td  style="text-align: left !important;">
							{if $v.left_px > 0}
							<span style="padding-left: {$v.left_px}px;"></span>
							|— {if $v.lvl <= 3}<i class="layui-icon x-show" status='true'>&#xe623;</i>{/if}{$v.title}
							{else}
							<i class="layui-icon x-show" status='true'>&#xe623;</i>
							{$v.title}
							{/if}
						</td>
						<td>{$v.sub_title}</td>
						<td><i class="layui-icon {$v.css}"></i></td>
						<td>{$v.name}</td>
						<td class="td-status" style="text-align: center;">
							<input type="checkbox" lay-text="显示|隐藏" {if $v.status=='1'}checked{/if} lay-skin="switch" lay-filter="switch_old" url="{:url('updateStatus',['key'=>'status','id'=>$v.id])}"/>
						</td>
						<td>
							<input type="text" data-key="sort" data-id="{$v.id}" data-url="{:url('update',['key'=>'sort','id'=>$v.id])}" value="{$v.sort}" class="layui-input x-sort tableInput"/>
						</td>
						<td>{$v.create_time}</td>
						<td>{$v.update_time}</td>
						<td class="td-manage">
							<a class="{:getBtnClass()}" onclick="openDrawer('编辑菜单','{:url(\'edit\',[\'id\'=>$v.id,\'pid\'=>$v.pid])}','50%','r')">编辑</a>
							{if $v.lvl <= 3}
							<a class="{:getBtnClass('warm')}" onclick="openDrawer('添加子菜单','{:url(\'edit\',[\'id\'=>0,\'pid\'=>$v.id])}','50%','r')">添加子菜单</a>
							{/if}
							{if $v.pid > 0}
							<a class="{:getBtnClass('danger',true)}" onclick="destroys(this,'{:url(\'update\')}','{$v.id}','is_del',1)">删除</a>
							{/if}
						</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
		</div>
	</div>
</div>
</body>
{include file="public/footer" /}
</html>